import time

import requests

from src.decoators.class_decorator import singleton_decorator


@singleton_decorator
class SessionSingleton(object):
    def __init__(self):
        self.__session = requests.Session()
        self.__session_build_time = 0

    @property
    def session(self):
        return self.__session

    @session.setter
    def session(self, session):
        self.__session = session

    @property
    def session_build_time(self):
        return self.__session_build_time

    @session_build_time.setter
    def session_build_time(self, value=int(time.time() * 1000)):
        self.__session_build_time = value
